﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using DTO;

namespace DAO
{
    public class NhanVienDAO
    {
        public static DataTable TimNhanVien(string manv, string hoten, string chucvu,string namvaolam, string bangcap,string phongban)
        {
            DataProvider db = new DataProvider();
            string sql = string.Format("Select nv.MaNV, nv.HoTen, nv.NgaySinh,nv.NamVaoLam,cv.TenChucVu,bc.TenBangCap,pb.TenPhongBan From NHANVIEN nv, CHUCVU cv,BANGCAP bc,PHONGBAN pb where nv.MaCV=cv.MaCV and nv.MaBC=bc.MaBC and nv.MaPB=pb.MaPB and nv.MaNV like '" + manv + "' and nv.HoTen like '" + hoten + "' and cv.TenChucVu like '" + chucvu + "' and nv.NamVaoLam like '" + namvaolam + "' and bc.TenBangCap like '" + bangcap + "' and pb.TenPhongBan like '" + phongban + "'");
            DataTable dt = db.executeQuery(sql);
            return dt;
        }
        public static DataTable LoadDSNhanVien()
        {
            DataProvider db = new DataProvider();
            string sql = "SELECT * FROM NHANVIEN";
            DataTable dt = db.executeQuery(sql);
            return dt;
        }
    }
}
